﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using xplang.run;

namespace xplang.abstractions
{
  public enum FlowState
  {
    Normal,
    RestartBlock,
    ExitFromBlock,
    ExitFromMethod,
    ThrowedException,
    TerminateApplication
  }
  public abstract class OpCode
  {
    //heap[0] = _this
    //heap[heap.Length-1] = function return
    public abstract Value doIt(Value[] heap, ref FlowState state);
    //public abstract void save(Scope scope, SourceBuilder target);
    //public abstract void toCSharp(Scope scope, SourceBuilder target);
    //public abstract void toJavaScript(Scope scope, SourceBuilder target);
  }
}
